<%@ page import="com.informet.ipd.modelo.dao.FisiMetaDao" %>
<%@ page import="com.informet.ipd.modelo.vo.FisiMetaMVO" %>
<%@ page import="com.informet.ipd.struts.form.PEIForm" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.swing.JOptionPane"%>
<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/tags/c" prefix="c"%>

<%
            StringBuffer cadenaSalida = new StringBuffer();
            List lista = null;
            int tFMe = Integer.parseInt(request.getParameter("tFMe"));
            Double mes1 = Double.parseDouble(request.getParameter("mes1"));
            Double mes2 = Double.parseDouble(request.getParameter("mes2"));
            Double mes3 = Double.parseDouble(request.getParameter("mes3"));
            Double mes4 = Double.parseDouble(request.getParameter("mes4"));
            Double mes5 = Double.parseDouble(request.getParameter("mes5"));
            Double mes6 = Double.parseDouble(request.getParameter("mes6"));
            Double mes7 = Double.parseDouble(request.getParameter("mes7"));
            Double mes8 = Double.parseDouble(request.getParameter("mes8"));
            Double mes9 = Double.parseDouble(request.getParameter("mes9"));
            Double mes10 = Double.parseDouble(request.getParameter("mes10"));
            Double mes11 = Double.parseDouble(request.getParameter("mes11"));
            Double mes12 = Double.parseDouble(request.getParameter("mes12"));
            FisiMetaDao supportFacade = new FisiMetaDao();
            PEIForm form1 = new PEIForm();
            FisiMetaMVO oFMe = null;
            try {
                int codMA = Integer.parseInt(request.getParameter("codMA"));
                int codFM = Integer.parseInt(request.getParameter("codFM"));
                int tipo = Integer.parseInt(request.getParameter("tipo"));
                oFMe = new FisiMetaMVO(codFM,codMA,tFMe,mes1,mes2,mes3,mes4,mes5,mes6,mes7,mes8,mes9,mes10,mes11,mes12);
                supportFacade.spManM(tipo, oFMe);
                lista = supportFacade.getFiltroM(codMA);
                form1.setListaFisiMeta(lista);
                cadenaSalida.append("<table id='tabla1' width='99%' align='right' class='userTable'>");
                cadenaSalida.append("<tr class='even' align='center'>");
                cadenaSalida.append("<th class='textoTR'>#</th>");
                            
                cadenaSalida.append("<th class='textoTR'>Meta</th> ");
                cadenaSalida.append("<th class='textoTR'>Total</th> ");     
                cadenaSalida.append("<th class='textoTR'>Ene</th> ");
                cadenaSalida.append("<th class='textoTR'>Feb</th> ");
                cadenaSalida.append("<th class='textoTR'>Mar</th> ");
                cadenaSalida.append("<th class='textoTR'>Abr</th> ");
                cadenaSalida.append("<th class='textoTR'>May</th> ");
                cadenaSalida.append("<th class='textoTR'>Jun</th> ");
                cadenaSalida.append("<th class='textoTR'>Jul</th> ");
                cadenaSalida.append("<th class='textoTR'>Ago</th> ");
                cadenaSalida.append("<th class='textoTR'>Set</th> ");
                cadenaSalida.append("<th class='textoTR'>Oct</th> ");
                cadenaSalida.append("<th class='textoTR'>Nov</th> ");
                cadenaSalida.append("<th class='textoTR'>Dic</th> ");
                cadenaSalida.append("<th class='textoTR'>Editar</th>");
                cadenaSalida.append("<th class='textoTR'>Eliminar</th> ");
                cadenaSalida.append("</tr>");
                int i=1;
                Iterator it = lista.iterator();
                while (it.hasNext()) {
                    oFMe = (FisiMetaMVO) it.next();
                    cadenaSalida.append("<tr align='center'> ");
                    cadenaSalida.append("<td width='10%' align='center'>" +i++ + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getStringTipoFisiMetaM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getMayor() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES1FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES2FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES3FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES4FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES5FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES6FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES7FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES8FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES9FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES10FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES11FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + oFMe.getNUM_MES12FISIMETAM() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>");
                    cadenaSalida.append("<img style='cursor:pointer' title='Editar' alt='Editar' border=0  src='images/b_edit.png' onclick=\"editarT('"+oFMe.getNUM_CODMETAAPER_PK()+"','"+oFMe.getTX_TIPOFISIMETAM()+"','"+oFMe.getNUM_MES1FISIMETAM()+"','"+oFMe.getNUM_MES2FISIMETAM()+"','"+oFMe.getNUM_MES3FISIMETAM()+"','"+oFMe.getNUM_MES4FISIMETAM()+"','"+oFMe.getNUM_MES5FISIMETAM()+"','"+oFMe.getNUM_MES6FISIMETAM()+"','"+oFMe.getNUM_MES7FISIMETAM()+"','"+oFMe.getNUM_MES8FISIMETAM()+"','"+oFMe.getNUM_MES9FISIMETAM()+"','"+oFMe.getNUM_MES10FISIMETAM()+"','"+oFMe.getNUM_MES11FISIMETAM()+"','"+oFMe.getNUM_MES12FISIMETAM()+"','"+oFMe.getNUM_CODFISIMETAM_PK()+"');\">");
                    cadenaSalida.append("</td>");
                    cadenaSalida.append("<td width='10%' align='center'> ");
                    cadenaSalida.append("<img style='cursor:pointer' title='Eliminar' alt='Eliminar' border=0  src='images/b_drop.png' onclick=\"eliminar('"+oFMe.getNUM_CODFISIMETAM_PK()+"','"+oFMe.getNUM_CODMETAAPER_PK()+"');\" >");
                    cadenaSalida.append("</td>");
                    cadenaSalida.append("</tr>");
                }
                //JOptionPane.showMessageDialog(null,"chau lisatrmetafisicaajax");
            } catch (Exception e) {
                cadenaSalida.append("error : "+e.toString());
                  
            }
            out.print(cadenaSalida);
%>